﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.Profile;
using System.Data;
using System.Text;

namespace WebSite.cn
{
    public partial class bottom : System.Web.UI.UserControl
    {
        // Fields
        public StringBuilder bottomsg = new StringBuilder();
        public string linkstr = "";

        // Methods
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!base.IsPostBack)
            {
               
               
                string sql = "select * from DB_Link where visible=1 and languages=1 order by linkorder";
                DataTable table = SQLAccess.GreatDs(sql).Tables[0];
                if (table.Rows.Count > 0)
                {
                    foreach (DataRow row in table.Rows)
                    {
                        if (row["linkfile"].ToString() != "")
                        {
                            string linkstr = this.linkstr;
                            this.linkstr = linkstr + "<a href='" + row["linkurl"].ToString() + "' target='_blank'><img src='/uploadfile/link/" + row["linkfile"].ToString() + "' border='0' /></a>  ";
                        }
                        else
                        {
                            string str4 = this.linkstr;
                            this.linkstr = str4 + "<a href='" + row["linkurl"].ToString() + "' target='_blank'>" + row["linkname"].ToString() + "</a>  ";
                        }
                    }
                }
                string str2 = "select classid,classlink,classname from DB_Class where parentid=0  and visible=1 and classname<>'' and (classpcs='底部' or classpcs='顶部和底部')  order by classorder";
                DataTable table2 = SQLAccess.GreatDs(str2).Tables[0];
                if (table2.Rows.Count > 0)
                {
                    foreach (DataRow row2 in table2.Rows)
                    {
                        if (row2["classlink"].ToString() != "")
                        {
                            this.bottomsg.AppendFormat("<TD height=\"27\" align=\"center\"><A title=\"{0}\" href=\"{1}\">{0}</A></TD>"
                                 , row2["classname"]            
                                 , row2["classlink"]
                                               );
                        }
                        else
                        {
                            this.bottomsg.AppendFormat("<TD height=\"27\" align=\"center\"><A title=\"{0}\" href=\"{1}\">{0}</A></TD>"
                                 , row2["classname"]           
                                , "content.aspx?cid=" + row2["classid"]
                                            );
                          
                        }
                    }
                }
            }
        }



    }
}